package com.xk.cart.config;

import com.xk.cart.interceptors.CartInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
///@Configuration注解是定义配置类
@Configuration
@EnableConfigurationProperties(JwtProperties.class)
public class MyWebAppConfigurer implements WebMvcConfigurer {
    @Autowired
    private JwtProperties prop;
    public void addInterceptors(InterceptorRegistry registry) {

        registry.addInterceptor(new CartInterceptor(prop)).addPathPatterns("/**");

    }
}
